export const getTimeByDateString = (date) => {

  // 验证输入是否为字符串
  if (typeof date !== 'string') {
    throw new Error('Invalid input: date must be a string.');
  }

  // 使用正则表达式检查日期格式
  const regex = /^\d{4}-\d{2}-\d{2}$/;
  if (!regex.test(date)) {
    throw new Error('Invalid date format. Expected YYYY-MM-DD.');
  }

  const d = new Date(`${date}T00:00:00`);

  if (isNaN(d.getTime())) {
    throw new Error('Invalid date.');
  }

  return d.getTime()
}